/* GUI CONVERTED from regetcum.p (converter v1.76) Thu Apr 25 19:00:54 2002 */
/* regetcum.p - REPETETIVE GET CUMULATIVE WORK ORDER ID.                      */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.4.1.2 $                                                       */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3            CREATED: 09/22/97   BY: *G2P5* Manmohan Pardesi   */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* $Revision: 1.4.1.2 $   BY: Jean Miller        DATE: 04/16/02  ECO: *P05H*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

{mfdeclre.i}

define input parameter part like op_part no-undo.
define input parameter site like rps_site no-undo.
define input parameter prline like rps_line no-undo.
define input parameter routing  as character format "x(18)"
   label "Routing" no-undo.
define input parameter bom_code as character format "x(18)"
   label "BOM" no-undo.
define output parameter wo_recno as recid no-undo.
define output parameter undo_tran like mfc_logical no-undo.

define buffer womstr1 for wo_mstr.

wo_recno = ?.
undo_tran = no.

for each wo_mstr
   where wo_type = "C"
     and wo_part = part
     and wo_site = site
     and wo_line = prline
     and (wo_routing = routing or (wo_routing = part and routing = ""))
     and (wo_bom_code = bom_code or (wo_bom_code = part and routing = ""))
no-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


   if wo_status <> "C" then do:

      wo_recno = recid(wo_mstr).
      find womstr1 where recid (womstr1) = wo_recno
      exclusive-lock no-wait no-error.

      if locked womstr1 then do:
         /*RECORD IS LOCKED. PLEASE TRY AGAIN LATER*/
         {pxmsg.i &MSGNUM=7006 &ERRORLEVEL=4}
         undo_tran = yes.
         leave.
      end.

      /* CREATE MARKER RECORD */
      {gprun.i ""remkcr.p""
         "(input womstr1.wo_lot,
           input 1,
           input mfguser,
           input global_userid)"}
/*GUI*/ if global-beam-me-up then undo, leave.


      leave.

   end. /* IF WO_STATUS <> "C" */

end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* FOR EACH WO_MSTR */
